package com.nantong.admin.controller;

import com.nantong.admin.annotation.PermissionRegister;
import com.nantong.common.core.domain.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 仪表盘
 *
 * @author nantong
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/system/dashboard")
@Tag(name = "仪表盘", description = "系统仪表盘相关接口")
@PermissionRegister(
    name = "仪表盘", 
    key = "dashboard", 
    type = 2,  // 2=菜单
    path = "/dashboard",
    component = "/views/Dashboard/DashboardView.vue",
    icon = "dashboard",
    sortOrder = 0
)
public class DashboardController {

    /**
     * 获取仪表盘数据
     */
    @GetMapping("/data")
    @Operation(summary = "获取仪表盘数据", description = "获取系统仪表盘数据")
    public R<Map<String, Object>> getData() {
        Map<String, Object> data = new HashMap<>();
        // 模拟一些仪表盘数据
        data.put("userCount", 1234);
        data.put("roleCount", 12);
        data.put("permissionCount", 86);
        data.put("systemModuleCount", 24);
        return R.ok(data);
    }
}
